00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 if ( !defined("PATH_TO_ROOT") ) {
00025 define( "PATH_TO_ROOT", "../../../" );
00026 }
00027
00028 require_once (PATH_TO_ROOT."ressourcen/classes/class.ressourcendb.inc.php");
00029 require_once (PATH_TO_ROOT."ressourcen/classes/class.filemanger.inc.php");
00030
00031 abstract class Resource {
00032 protected $fileID;
00033 protected $courseID;
00034 protected $userID;
00035 protected $link;
00036 protected $name;
00037 protected $visibleType;
00038 protected $createTime;
00039 protected $description;
00040
00041 protected $fileManager = null;
00042
00043 public function getID() {
00044 return $this->fileID;
00045 }
00046
00047 public function setFileManager( $fileManager ) {
00048 $this->fileManager = $fileManager;
00049 }
00050
00051 public function getFileManager() {
00052 return $this->fileManager;
00053 }
00054
00055 public function setCreateTime( $createTime ) {
00056 $this->createTime = $createTime;
00057 }
00058
00064 public function setDescription ( $description ) {
00065 $this->description = $description ;
00066 }
00067
00073 public function getDescription() {
00074 return $this->description;
00075 }
00076
00077 public function setFileID ( $fileID ) {
00078 $this->fileID = $fileID;
00079 }
00080
00081 public function setCourseID ( $courseID ) {
00082 $this->courseID = $courseID;
00083 }
00084
00090 public function getCourseID () {
00091 return $this->courseID;
00092 }
00093
00094 public function setUserID ( $userID ) {
00095 $this->userID = $userID;
00096 }
00097
00098 public function setLink ( $link ) {
00099 $this->link = $link;
00100 }
00101
00102 public function setVisibleType ( $visibleType ) {
00103 $this->visibleType = $visibleType;
00104 }
00105
00106 public function setName ( $name ) {
00107 $this->name = $name;
00108 }
00109
00110 public function getName() {
00111 return $this->name;
00112 }
00113
00114 public function getLink() {
00115 return $this->link;
00116 }
00117
00118 protected function getRessourceVisibilityHTML() {
00119 $visibleSelect = "<div class='res_file-extra'>"."Sichtbarkeit ändern: <br/>";
00120 $activeFolder = $this->fileManager->getActiveFolder();
00121 $action = $this->fileManager->getAction();
00122 $actionID = $this->fileManager->getActionID();
00123 if (isset($_GET['mode'])) {
00124 $mode = $_GET['mode'];
00125 $mode1 = "<a href='".$this->createLink(0, array('activeFolder' => $activeFolder, "action" => "setVisibilityDocentsOnly", 'actionID' => $actionID, 'mode' => $mode)) ."'>Dozenten</a> ";
00126 $mode2 = "<a href='".$this->createLink(0, array('activeFolder' => $activeFolder, "action" => "setVisibilityNoStudents", 'actionID' => $actionID, 'mode' => $mode)) ."'>Dozenten und Tutoren</a> ";
00127 $mode3 = "<a href='".$this->createLink(0, array('activeFolder' => $activeFolder, "action" => "setVisibilityAll", 'actionID' => $actionID, 'mode' => $mode)) ."'>Alle</a> ";
00128 } else {
00129 $mode = 1;
00130 $mode1 = "<a href='".$this->createLink(0, array('activeFolder' => $activeFolder, "action" => "setVisibilityDocentsOnly", 'actionID' => $actionID, 'mode' => $mode)) ."'>Dozenten</a> ";
00131 $mode2 = "<a href='".$this->createLink(0, array('activeFolder' => $activeFolder, "action" => "setVisibilityNoStudents", 'actionID' => $actionID, 'mode' => $mode)) ."'>Dozenten und Tutoren</a> ";
00132 $mode3 = "<a href='".$this->createLink(0, array('activeFolder' => $activeFolder, "action" => "setVisibilityAll", 'actionID' => $actionID, 'mode' => $mode)) ."'>Alle</a> ";
00133 }
00134 if ($mode == 1) {
00135 switch ($this->visibleType) {
00136 case 3:
00137 $visibleSelect.= "<b>Dozenten</b> ".$mode2.$mode3;
00138 break;
00139
00140 case 2:
00141 $visibleSelect.= $mode1."<b>Dozenten und Tutoren</b> ".$mode3;
00142 break;
00143
00144 case 1:
00145 $visibleSelect.= $mode1.$mode2."<b>Alle</b> ";
00146 break;
00147 }
00148 } else $visibleSelect.= $mode1.$mode2.$mode3;
00149 $visibleSelect.= "<a href='".$this->createLink(0, array("activeFolder" => $activeFolder)) ."'>Abbrechen</a> ".Utilities::helpCode(700) ."</div>";
00150 return $visibleSelect;
00151 }
00152
00153
00163 public static function createLink($oldOnes = true, $vars = '', $link = '') {
00164 if ($link == "") $link = PATH_TO_ROOT.SCRIPT_NAME;
00165 if (!is_array($vars)) $vars = $_GET;
00166 elseif (count($_GET) > 0 && $oldOnes) $vars = array_merge($_GET, $vars);
00167 foreach($vars as $getVarName => $getVarValue) {
00168 if (trim($getVarValue) != "" && isset($getVarValue)) $getVars[] = urlencode($getVarName) ."=".urlencode($getVarValue);
00169 }
00170 return $link."?".implode($getVars, "&");
00171 }
00172
00173 }